﻿CREATE TABLE [dbo].[user_Share] (
    [HashCode] NVARCHAR (128)   NOT NULL,
    [UserId]   UNIQUEIDENTIFIER NOT NULL,
    [TextId]   BIGINT           NOT NULL,
    CONSTRAINT [PK_user_Share] PRIMARY KEY CLUSTERED ([HashCode] ASC),
    CONSTRAINT [FK_user_Share_text_Text] FOREIGN KEY ([TextId]) REFERENCES [dbo].[text_Text] ([TextId]),
    CONSTRAINT [FK_user_Share_user_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[user_User] ([UserId])
);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_user_Share_UserId_TextId]
    ON [dbo].[user_Share]([UserId] ASC, [TextId] ASC);

